package mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import pojo.User;

import java.io.IOException;
import java.util.List;

public interface UserMapper {
    List<User> selectByUsername(String username);//查询所有数据

    @Select("SELECT COUNT(*) FROM user WHERE username = #{username} AND password = #{password}")
    int login(@Param("username") String username, @Param("password") String password);

    @Select("SELECT COUNT(*) FROM user WHERE username = #{username}")
    int username(@Param("username") String username);

    @Select("SELECT COUNT(*) FROM user WHERE username = #{username}")
    int password(@Param("username") String username);

    void delete(User user) throws IOException;

    void add(User user) throws IOException;

    void update(User user) throws IOException;
}
